# -*- coding: utf-8 -*-

# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html

import random
from zhihu_user.settings import IPPOOL


class ZhihuUserSpiderMiddleware(object):

    def process_request(self, request, spider):
        ip = random.choice(IPPOOL)
        request.meta['proxy'] = ip

